﻿using NHibernate;
using NHibernate.Tool.hbm2ddl;
using Sirocco.Data.Helper;

namespace Sirocco.Data.Schema
{
    public class SchemaGenerator
    {
        public void GenerateSchema(ISession session)
        {
            if (NHibernateSessionManager.Instance == null) 
                return;

            var mgr = NHibernateSessionManager.Instance;
            var cfg = mgr.GetConfiguration();
            
            var schemaExport = new SchemaExport(cfg);
            schemaExport.Create(true, true);
        }
    }
}
